home *** CD-ROM | disk | FTP | other *** search
- ATARI MACHINE SPECIFIC LIBRARY
-
-
-
- NAME
- Joystick - access to standard Atari joysticks
-
- SYNOPSIS
- #include <Joystick.h>
-
- enum JoystickDirection
- class Joystick
-
- DESCRIPTION
- The standard Atari joysticks are basicaaly four switches indicating
- Up, Down, Left, and Right. Diagonals are achieved by combinations
- of pairs of these, such as Up-Left. When devices other than normal
- joysticks are connected, it is possible to have "directions" such
- as Up-Down, or even Up-Down-Left-Right. Joysticks also have a single
- trigger switch (even if the physical joystick may have multiple
- trigger buttons).
-
- CLASSES
- A Joystick class object represents fairly exactly the physical stick.
-
- CLASS MEMBERS
- Joystick::
- Joystick(int port=1)
- Create a joystick representing the stick connected to the left or
- right joystick port (default is right).
-
- bool Up()
- TRUE if the joystick is pushed up (or up-left, up-right, etc.)
-
- bool Down()
- TRUE if the joystick is pushed down (or down-left, down-right, etc.)
-
- bool Left()
- TRUE if the joystick is pushed left (or up-left, down-left, etc.)
-
- bool Right()
- TRUE if the joystick is pushed right (or down-right, up-right, etc.)
-
- bool Trigger()
- TRUE if the joystick trigger is pushed down.
-
- int X()
- int Y()
- -1, 0, or +1 interpretation of joystick, eg. if Stick.Up() == TRUE,
- then Stick.Y() == -1.
-
- JoystickDirection Way()
- Returns the direction of the joystick.
-
- bool Passive()
- TRUE iff the joystick is not pushed in any direction, and the
- trigger is not pressed.
-
- USAGE
- Simply declare a joystick, then use it. When it goes out of scope,
- it will revert to the previous state. For example, if you declare
- Joystick(0), you cannot use the mouse (which shares that port) until
- theat stick goes out of scope.
-
- EXAMPLES
- Joystick stick;
- Sprite ship("ship.spr");
-
- while (!stick.Trigger()) {
- ship.MoveBy(stick.X(),stick.Y());
- ship.Wipe();
- ship.Draw();
- Pages->Flip();
- }
-
- (Of course, here we have not set-up the double buffer, or checked the
- bounds of the sprite to keep it from going off the screen!).
-
- SEE ALSO
- Mouse
-
- BUGS
- The trigger on the right stick is equivalent to the right mouse button.
- This is a hardware thing that cannot be overcome in software.
-
- AUTHOR
- Warwick Allison, 1992.
- warwick@cs.uq.oz.au
-
- COPYING
- This functionality is part of the Atari Machine Specific Library,
- and is Copyright 1992 by Warwick W. Allison.
-
- The Atari Machine Specific Library is free and protected under the
- GNU Library General Public License.
-
- You are free to copy and modify these sources, provided you acknowledge
- the origin by retaining this notice, and adhere to the conditions
- described in the GNU LGPL.
-